﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Admin.Master" Inherits="System.Web.Mvc.ViewPage<CourseSystem.Core.Entities.ExaminationSummaryInfo>" %>

<%@ Import Namespace="System.Globalization" %>
<%@ Import Namespace="CourseSystem.Common.Helpers" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    阅卷打分
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <% Html.RenderPartial("AdminTopUc", "阅卷打分"); %>
    <table width="100%" height="5" border="0" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF">
        <tr>
            <td height="5" bgcolor="#FFFFFF">
            </td>
        </tr>
    </table>
    <div id="listDiv">
        <table width="100%" border="0" cellpadding="4" cellspacing="1" class="table03">
            <tr class="box06">
                <td width="10%" align="center">
                    学生学号
                </td>
                <td width="10%" align="center">
                    姓名
                </td>
                <td width="10%" align="center">
                    试卷类型
                </td>
                <td width="30%" align="center">
                    试卷名称
                </td>
                <td width="20%" align="center">
                    试卷总分
                </td>
                <td width="20%" align="center">
                    学生总分
                </td>
            </tr>
            <tr class="box02" onmouseover="this.className='bg3'" onmouseout="this.className='bg4'"
                bgcolor="#FFFFFF">
                <td height="27" align="center">
                    <%=Model.StudentInfo.Uid%>
                </td>
                <td align="center">
                    <%=Model.StudentInfo.StuName%>
                </td>
                <td align="center">
                    <%=ExamLibHelper.GetExamName(Model.ExaminationInfo)%>
                </td>
                <td align="center">
                    <%=Model.ExaminationInfo.Title%>
                </td>
                <td align="center">
                   100
                </td>
                <td align="center">
                    <%=Model.Score%>
                </td>
            </tr>
        </table>
    </div>
    <% var examInfo = Model.ExaminationInfo;
       var currentTitleId = 1;
       var stuKeyList = examInfo.ExamAnswerInfo.Where(o => o.Uid == Model.StudentInfo.Id).ToList();
       var type0Model =
       examInfo.ExaminationItemInfo.Where(o => o.QuestionLibInfo.Type == 0).ToList();
       var type0Count = type0Model.Count;
       var type1Model =
           examInfo.ExaminationItemInfo.Where(o => o.QuestionLibInfo.Type == 1).ToList();
       var type1Count = type1Model.Count;
       var type2Model =
          examInfo.ExaminationItemInfo.Where(o => o.QuestionLibInfo.Type == 2).ToList();
       var type2Count = type2Model.Count;
       var type3Model =
          examInfo.ExaminationItemInfo.Where(o => o.QuestionLibInfo.Type == 3).ToList();
       var type3Count = type3Model.Count;
       var type4Model =
          examInfo.ExaminationItemInfo.Where(o => o.QuestionLibInfo.Type == 4).ToList();
       var type4Count = type4Model.Count; 
    %>
    <%using (Html.BeginForm("ExamReviewSave","AdminExamLib",new{Model.Id}))
      { %>
    <% if (type0Count != 0)
       {
           var i = 1; %>
    <table width="100%" border="0" cellpadding="4" cellspacing="1" class="table03">
        <tr class="box01">
            <td width="7%" height="27" align="center">
                <div align="left">
                    <%= NumHelper.GetChineseNum(currentTitleId++) %>、<strong>单项选择题</strong>
                </div>
            </td>
        </tr>
        <% foreach (var item in type0Model)
           {
               var keyInfo =
                                stuKeyList.FirstOrDefault(o => o.Qid == item.Qid);
               
        %>
        <tr class="box02">
            <td height="25" align="center">
                <div align="left">
                    <% var score1 = ExamLibHelper.GetScoreTran(item.QuestionLibInfo.Score, item.ExaminationInfo.Score); %>
                    <span class="style53">[<%=score1%>分]</span><%= i++ %>．<%= item.QuestionLibInfo.Title %>
                    <br />
                    <% for (int j = 0; j < item.QuestionLibInfo.RadioChoicesInfo.Count; j++)
                       {
                           var info = item.QuestionLibInfo.RadioChoicesInfo[j];
                    %>
                    <%= Html.RadioButton("radio" + item.QuestionLibInfo.Id, info.Id,
                                                                            keyInfo != null &&
                                                                            keyInfo.AnswerId == info.Id,
                                                                            new {id = "radio" + info.Id}) %>
                    <label for="radio<%= info.Id %>">
                        <%= RadioChoicesHelper.GetChoiceLetter(j) %>.<%= info.Title %></label>
                    <% if (info.IsAnswer)
                       { %><span class="style53">[答案]</span><% } %>
                    <% } %>
                </div>
            </td>
        </tr>
        <tr class="box02">
            <td height="25" align="center">
                <div align="left">
                    本题得分：<span class="clink"><%=keyInfo == null ? "0" : keyInfo.Score.ToString()%>分&nbsp;</span>
                    <br />
                    <% if (keyInfo != null)
                       {%>
                    <span class="dlink">评语:</span><%= Html.TextArea("comment" + keyInfo.Id, keyInfo.Comment, new {@class = "commentscoringArea"}) %><% } %></div>
            </td>
        </tr>
        <% } %>
    </table>
    <% } %>
    <% if (type1Count != 0)
       {
           var i = 1; %>
    <table width="100%" border="0" cellpadding="4" cellspacing="1" class="table03">
        <tr class="box01">
            <td width="7%" height="27" align="center">
                <div align="left">
                    <%= NumHelper.GetChineseNum(currentTitleId++) %>、<strong>多项选择题</strong>
                </div>
            </td>
        </tr>
        <% foreach (var item in type1Model)
           {
               var keyInfo =
                                stuKeyList.FirstOrDefault(o => o.Qid == item.Qid);
               
        %>
        <tr class="box02">
            <td height="25" align="center">
                <div align="left">
                     <% var score2 = ExamLibHelper.GetScoreTran(item.QuestionLibInfo.Score, item.ExaminationInfo.Score); %>
                    <span class="style53">[<%= score2%>分]</span><%= i++ %>．<%= item.QuestionLibInfo.Title %>
                    <br />
                    <% for (int j = 0; j < item.QuestionLibInfo.RadioChoicesInfo.Count; j++)
                       {
                           var info = item.QuestionLibInfo.RadioChoicesInfo[j];
                    %>
                    <%= Html.CheckBox("check" + info.Id,
                                                                                        keyInfo != null &&
                                                                                        (","+keyInfo.Answer+",").Contains(","+info.Id+","),
                                                                                        new {id = "check" + info.Id}) %>
                    <label for="check<%= info.Id %>">
                        <%= RadioChoicesHelper.GetChoiceLetter(j) %>.<%= info.Title %></label>
                    <% if (info.IsAnswer)
                       { %><span class="style53">[答案]</span><% } %>
                    <% } %>
                </div>
            </td>
        </tr>
        <tr class="box02">
            <td height="25" align="center">
                <div align="left">
                    本题得分：<span class="clink"><%=keyInfo == null ? "0" : keyInfo.Score.ToString()%>分&nbsp;</span>
                    <br />
                    <% if (keyInfo != null)
                       {%><span class="dlink">评语:</span><%= Html.TextArea("comment" + keyInfo.Id, keyInfo.Comment, new {@class = "commentscoringArea"}) %><% } %></div>
            </td>
        </tr>
        <% } %>
    </table>
    <% } %>
    <% if (type2Count != 0)
       {
           var i = 1; %>
    <table width="100%" border="0" cellpadding="4" cellspacing="1" class="table03">
        <tr class="box01">
            <td width="7%" height="27" align="center">
                <div align="left">
                    <%= NumHelper.GetChineseNum(currentTitleId++) %>、<strong>判断题</strong>
                </div>
            </td>
        </tr>
        <% foreach (var item in type2Model)
           {
               var keyInfo =
                                stuKeyList.FirstOrDefault(o => o.Qid == item.Qid);
               
        %>
        <tr class="box02">
            <td height="25" align="center">
                <div align="left">
                      <% var score3 = ExamLibHelper.GetScoreTran(item.QuestionLibInfo.Score, item.ExaminationInfo.Score); %>
                    <span class="style53">[<%=score3%>分]</span><%= i++ %>．<%= item.QuestionLibInfo.Title %>
                    <br />
                    该命题是否正确?<%= Html.CheckBox("checkpan" + item.QuestionLibInfo.Id,keyInfo != null &&string.IsNullOrEmpty(keyInfo.Answer))%>
                    <br />
                    <span class="style53">[答案]</span>[该命题<%=string.IsNullOrEmpty(item.QuestionLibInfo.QuestionAnswerInfo.Answer)?"":"不" %>正确]
                </div>
            </td>
        </tr>
        <tr class="box02">
            <td height="25" align="center">
                <div align="left">
                    本题得分：<span class="clink"><%=keyInfo == null ? "0" : keyInfo.Score.ToString()%>分&nbsp;</span>
                    <br />
                   <% if (keyInfo != null)
                      {%> <span class="dlink">评语:</span><%= Html.TextArea("comment" + keyInfo.Id, keyInfo.Comment, new {@class = "commentscoringArea"}) %><% } %></div>
            </td>
        </tr>
        <% } %>
    </table>
    <% } %>
    <% if (type3Count != 0)
       {
           var i = 1; %>
    <table width="100%" border="0" cellpadding="4" cellspacing="1" class="table03">
        <tr class="box01">
            <td width="7%" height="27" align="center">
                <div align="left">
                    <%= NumHelper.GetChineseNum(currentTitleId++) %>、<strong>简述题</strong>
                </div>
            </td>
        </tr>
        <% foreach (var item in type3Model)
           {
               var keyInfo =
                                stuKeyList.FirstOrDefault(o => o.Qid == item.Qid);
               
        %>
        <tr class="box02">
            <td height="25" align="center">
                <div align="left">
                     <% var score4 = ExamLibHelper.GetScoreTran(item.QuestionLibInfo.Score, item.ExaminationInfo.Score); %>
                    <span class="style53">[<%= score4%>分]</span><%= i++ %>．<%= item.QuestionLibInfo.Title %>
                    <br />
                    <%=keyInfo.Answer %>
                    <br />
                    <span class="style53">[答案]</span><%=item.QuestionLibInfo.QuestionAnswerInfo.Answer %>
                </div>
            </td>
        </tr>
        <tr class="box02">
            <td height="25" align="center">
                <div align="left">
                    本题得分：<span class="clink"><%=ExamLibHelper.GetItemScore(keyInfo.Id, score4, keyInfo.Score)%></span>
                    <br />
                    <% if (keyInfo != null)
                       {%><span class="dlink">评语:</span><%= Html.TextArea("comment" + keyInfo.Id, keyInfo.Comment, new {@class = "commentscoringArea"}) %><% } %></div>
            </td>
        </tr>
        <% } %>
    </table>
    <% } %>
       <% if (type4Count != 0)
       {
           var i = 1; %>
    <table width="100%" border="0" cellpadding="4" cellspacing="1" class="table03">
        <tr class="box01">
            <td width="7%" height="27" align="center">
                <div align="left">
                    <%= NumHelper.GetChineseNum(currentTitleId++) %>、<strong>思考题</strong>
                </div>
            </td>
        </tr>
        <% foreach (var item in type4Model)
           {
               var keyInfo =
                                stuKeyList.FirstOrDefault(o => o.Qid == item.Qid);
               
        %>
        <tr class="box02">
            <td height="25" align="center">
                <div align="left">
                     <% var score5 = ExamLibHelper.GetScoreTran(item.QuestionLibInfo.Score, item.ExaminationInfo.Score); %>
                    <span class="style53">[<%= score5%>分]</span><%= i++ %>．<%= item.QuestionLibInfo.Title %>
                    <br />
                    <%=keyInfo.Answer %>
                    <br />
                    <span class="style53">[答案]</span><%=item.QuestionLibInfo.QuestionAnswerInfo.Answer %>
                </div>
            </td>
        </tr>
        <tr class="box02">
            <td height="25" align="center">
                <div align="left">
                    本题得分：<span class="clink"><%=ExamLibHelper.GetItemScore(keyInfo.Id, score5, keyInfo.Score)%></span>
                    <br />
                    <% if (keyInfo != null)
                       {%><span class="dlink">评语:</span><%= Html.TextArea("comment" + keyInfo.Id, keyInfo.Comment, new {@class = "commentscoringArea"}) %><% } %></div>
            </td>
        </tr>
        <% } %>
    </table>
    <% } %>
    <div align="center">
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
                <td height="42">
                    <div align="center">
                        <input type="submit" name="Save" value="保存阅卷" />
                        &nbsp;
                        <input type="submit" name="Submit" value="提交阅卷" />
                        &nbsp;
                        <%=Html.ActionButton("返回","Scoring") %>
                    </div>
                </td>
            </tr>
        </table>
    </div>
    <%} %>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="HeaderContent" runat="server">
</asp:Content>
